package com.ht.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ht.domain.bo.TbKnowledgeBO;
import com.ht.domain.po.TbKnowledge;
import com.ht.mapper.TbKnowledgeMapper;
import com.ht.service.TbKnowledgeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class TbKnowledgeServiceImpl implements TbKnowledgeService {
    @Autowired
    private TbKnowledgeMapper tbKnowledgeMapper;

    @Override
    public List<TbKnowledgeBO> queryJuniorByjuniortId(Long juniorId) {
        QueryWrapper q = new QueryWrapper();
        q.eq("junior_id",juniorId);
        List<TbKnowledge> list = tbKnowledgeMapper.selectList(q);
        List<TbKnowledgeBO> listt = new ArrayList<>();
        list.forEach(obj->{
            TbKnowledgeBO bo = new TbKnowledgeBO();
            BeanUtil.copyProperties(obj,bo);
            listt.add(bo);
        });
        return listt;
    }
}
